<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<p id="js">Javascript</p>
<div id="list">
    <p id="se">javaSE</p>
    <p id="ee">javaEE</p>
    <p id="me">javaME</p>
</div>

<script>
    let js = document.getElementById("js");
    let ee = document.getElementById("ee");
    let list = document.getElementById("list");

    let newP = document.createElement("p");// 创建一个p标签
    newP.id = "newP";
    newP.innerText = "Hello, World!";

    let myScript = document.createElement("script");// 创建一个标签节点
    myScript.setAttribute("type", "text/javascript");

    let myStyle = document.createElement("style");// 创建一个空Style标签
    myStyle.setAttribute("type", "text/css");
    myStyle.innerHTML = "body{background : red;}";// 设置标签内容

    // list.appendChild(js);//追加
    list.insertBefore(js, ee);
    list.appendChild(newP);
    list.appendChild(myScript);
    list.appendChild(myStyle);
</script>

</body>
</html>